<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  <title>Polly - Getting Started</title>
  <link type="text/css" rel="stylesheet" href="menu.css" />
  <link type="text/css" rel="stylesheet" href="content.css" />
</head>
<body>

<div id="box">
<!--#include virtual="menu.html.incl"-->

<div id="content">

<h1>Building and Installing Polly</h1>

<h2> Automatic </h2>

There is a <a href="polly.sh">script</a> available to automatically checkout,
update, build, and test Polly. This script contains all the commands that are
subsequently described on this webpage. The automatic installation consists
of four simple steps:

<pre>
mkdir polly &amp;&amp; cd polly
wget https://polly.llvm.org/polly.sh
chmod +x polly.sh
./polly.sh
</pre>

<h2> Manual </h2>
<h3 id="source"> Get the code </h3>

<pre>
git clone https://github.com/llvm/llvm-project.git llvm_git
</pre>
<h3 id="build">Build Polly</h3>

<pre>
mkdir llvm_build && cd llvm_build
cmake -DLLVM_ENABLE_PROJECTS='polly;clang' ../llvm_git/llvm && make
</pre>

<h3> Test Polly</h3>

<pre>make check-polly</pre>

<h3>Building Polly Without LLVM</h3>
It is also possible to build Polly without
also building LLVM. All you need is an installed version of LLVM or a previous
build. To configure Polly to use a pre-built LLVM, set the
<code>-DCMAKE_PREFIX_PATH</code> option:

<pre>cmake -DCMAKE_PREFIX_PATH=${LLVM_PREFIX}/lib/cmake/llvm ../llvm_git/polly</pre>

To run unittests, however, you need to have the LLVM source directory around.
Polly will use the <code>llvm-config</code> of the LLVM you're building against
to guess the location of the source directory. You may override autodetected
location by setting the <code>-DLLVM_SOURCE_ROOT</code> option.

<h3> Troubleshooting</h3>

<p>If you get an error in one of the python files, your system probably uses python3
as default python interpreter. This is the case, for instance, under Arch Linux.
To solve this issue, run <code>cmake</code> again, but with the added argument:
<code>-DPYTHON_EXECUTABLE=/usr/bin/python2</code> (replace <code>/usr/bin/python2</code>
with the location of the python2 interpreter under your system).

<pre>cmake -DCMAKE_PREFIX_PATH=${ISL_INSTALL} -DPYTHON_EXECUTABLE=/usr/bin/python2 ${LLVM_SRC}</pre>

</div>
</div>

</body>
</html>
